package fb.chatter.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * The class for read/write text file
 * @author hoannguyen
 *
 */
public final class FileUtils {
	
	private FileUtils(){
		
	}
	
	/**
	 * To get text file body with the given filepath
	 * @param filePath
	 * @return
	 */
	public static String getTextFile(String filePath) {
		String content = "";
		try {
			BufferedReader in = new BufferedReader(new FileReader(filePath));
			content += in.readLine();
			String line;
			while ((line = in.readLine()) != null) {
				content += line;
			}
			in.close();
		} catch (IOException e) {
			content = null;
		}
		return content;
	}
}
